import {createContext, useContext} from 'react'

export const CounterStoreContext = createContext()

export const useCounterStoreContext = () => {
    const store = useContext(CounterStoreContext)
    if (!store) {
        throw new Error('useCounterStoreContext must be used in component scrolled in CounterStoreContext.Provider')
    }
    return store
}